import { createStore, createLogger } from 'vuex'
import createPersistedstate from 'vuex-persistedstate'
import cart from '@/store/modules/cart'
import user from '@/store/modules/user'

export default createStore({

  modules: {
    cart,
    user
  },
  plugins: [
    // 自动打印插件
    createLogger(),
    // 持久化存储插件
    createPersistedstate({
      // key 名称
      key: 'erabbit-client-pc-store-66',
      // 需要持久化的模块
      paths: ['user', 'cart']
    })
  ]
})
